import 'dart:io';

String join(String path1, String path2) {
  bool hasSep1 = path1.endsWith("/");
  bool hasSep2 = path2.endsWith("/");
  if (Platform.isWindows) {
    hasSep1 |= path1.endsWith("\\");
    hasSep2 |= path2.endsWith("\\");
  }
  if (hasSep1 != hasSep2) {
    return path1 + path2;
  } else if (hasSep1) {
    return path1 + path2.substring(1);
  } else {
    return path1 + Platform.pathSeparator + path2;
  }
}
